{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from requests_html import HTMLSession\n",
    "session = HTMLSession()\n",
    "url = 'http://www.spbeen.com/tool/request_info'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "headers = {\n",
    "    'User-Agent': '1234567890abcdefghijklmnopqrstuvwxyz'\n",
    "}\n",
    "proxies = {\n",
    "    'http': 'http://104.129.194.32:10605',\n",
    "#     'https': 'https://1.1.1.1:999'\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "User-Agent: 1234567890abcdefghijklmnopqrstuvwxyz, \n",
      "IP: 104.129.194.112\n"
     ]
    }
   ],
   "source": [
    "response = session.get(url, headers=headers, proxies=proxies)\n",
    "ua = response.html.xpath('.//div[@class=\"pusher\"]/div[@class=\"content\"]/div/div[2]/div[2]')\n",
    "ip = response.html.xpath('.//div[@class=\"pusher\"]/div[@class=\"content\"]/div/div[3]/div[2]')\n",
    "print('User-Agent: {}, \\nIP: {}'.format(ua[0].text, ip[0].text))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
